"""
Case Type   : SQL
Case Name   : 创建列加密密钥的语法显示验证
Create At   : 2022/8/15
Owner       : haomeng802
Description :
    1.使用\h命令验证 创建列加密密钥的语法显示正确与否
Expect      :
    1.显示正确：with 和values是关键字且必須添加
History     :
"""

import os
import unittest
from testcase.utils.Logger import Logger
from testcase.utils.CommonSH import CommonSH


class Sql_Operation(unittest.TestCase):
    def setUp(self):
        self.log = Logger()
        self.log.info(f'-----{os.path.basename(__file__)} start-----')
        self.commonsh = CommonSH('PrimaryDbUser')

    def test_explain(self):
        text = '-----step1:使用\h命令验证 创建列加密密钥的语法显示正确与否;' \
               'expect:显示正确：with 和values是关键字且必須添加-----'
        self.log.info(text)
        sql_cmd = self.commonsh.execut_db_sql(
            f'\h create column encryption key;')
        self.log.info(sql_cmd)
        assert_msg = f"WITH VALUES"
        self.assertIn(assert_msg, sql_cmd, '执行失败' + text)

    def tearDown(self):
        self.log.info('-----无需清理环境-----')
        self.log.info(f'-----{os.path.basename(__file__)} end-----')

